//
//  HWGameCommunityDetailProtocol.m
//  HWanGame
//
//  Created by 王昌健 on 2022/10/20.
//  Copyright © 2022 94Wan. All rights reserved.
//

#import "HWGameCommunityDetailProtocol.h"

@implementation HWGameCommunityDetailProtocol
- (instancetype)init
{
    self = [super init];
    if (self) {

    }
    return self;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    HWGameCommunityDetailCommentHeader *header = [HWGameCommunityDetailCommentHeader headerOrFooterWithTableViewWithTableView:tableView];
    header.model = self.models[section];
    header.replyButtonClick = ^(HWGameCommunityDetailCommentModel * mod) {
        self.replyButtonClick(mod);
    };
    header.zanButtonClick = ^(HWGameCommunityDetailCommentModel * mod) {
        self.zanButtonClick(mod);
    };
    return header;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return self.models[section].list.count;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return self.models.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    HWGameCommunityDetailCommentCell *commentCell = [HWGameCommunityDetailCommentCell cellWithTableView:tableView];
    commentCell.model = self.models[indexPath.section].list[indexPath.row];
    commentCell.replyButtonClick = ^(HWGameCommunityDetailCommentModel * mod) {
        self.replyButtonClick(mod);
    };
    commentCell.zanButtonClick = ^(HWGameCommunityDetailCommentModel * mod) {
        self.zanButtonClick(mod);
    };
    return commentCell;
}
@end
